#ifndef ELK_DOWNLOAD_VIEW_H
#define ELK_DOWNLOAD_VIEW_H

#include <QWidget>
#include "elk_download_manager.h"
#include "elk_web_delegate.h"

namespace Ui {
class ElkDownloadView;
}

class ElkDownloadView : public QWidget
{
    Q_OBJECT

public:
    explicit ElkDownloadView(QWidget *parent = nullptr);
    ~ElkDownloadView();

    void bind(QWeakPointer<ElkWebDelegate> delegate);
    void request(const QString &url, const QString &fileName);

private slots:
    void onDownloadRequested(const QString &url,
                             const QString &fileName);
    void on_lineEditURL_returnPressed();
    void on_pushButtonDownload_clicked();

private:
    Ui::ElkDownloadView *ui;
    ElkDownloadManager *downloadManager_ = nullptr;
    QWeakPointer<ElkWebDelegate> delegate_;
};

#endif // ELK_DOWNLOAD_VIEW_H
